<?php

namespace mpend\models;

use Yii;
use mpend\models\User;
use common\models\user\UserConnect;
use common\models\ThirdPartyAuthorization;

/**
 * 第三方登录授权
 * ThirdPartyAuthForm
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class WechatAuthForm extends ThirdPartyAuthorization {

    /**
     * Signs user up.
     * @return User|null the saved model or null if saving fails
     */
    public function connect() {
        $auth = $this->authent();
        if ($auth === false && !($auth instanceof UserConnect)) {
            return $this->dumpError('授权获取失败');
        }
        return $auth;
    }

}
